# -*- coding: utf-8 -*-
from model_utils.choices import Choices

# API接口通用错误
API_MESSAGE_OK = 0
API_MESSAGE_FORBIDDEN = 403
API_MESSAGE_PARAM_ERROR = 400
API_MESSAGE_NOT_FOUND = 404
API_MESSAGE_SERVER_ERROR = 500

API_MESSAGE_TABLE = Choices(
    (API_MESSAGE_OK, 'OK'),
    (API_MESSAGE_FORBIDDEN, '权限不足'),
    (API_MESSAGE_PARAM_ERROR, '参数错误'),
    (API_MESSAGE_NOT_FOUND, '资源未找到'),
    (API_MESSAGE_SERVER_ERROR, '服务端异常,请稍后再试'),
)

# 全局常量定义
STATUS_BIND = 0  # 禁用
STATUS_NORMAL = 1  # 正常

# 通用成功返回码
SUCCESS = 0

STATUS_CHOICE = Choices(
    (STATUS_NORMAL, '启用'),
    (STATUS_BIND, '禁用'),
)

# bool类型统一定义，0：false，1：true
BOOL_TYPE_FALSE = 0
BOOL_TYPE_TRUE = 1

BOOL_TYPE_CHOICE = Choices(
    (BOOL_TYPE_FALSE, '否'),
    (BOOL_TYPE_TRUE, '是')
)

# 逻辑删除字段
LOG_DELETED = 1

# 过期时间 minute
EXPIRE_TIME_SECOND = 1

# None
DEFAULT_PARAM_NONE = None
# 默认状态
DEFAULT_STATUS = 1
# 默认租户id
DEFAULT_TENANT_ID = '000000'
# 0
DEFAULT_ZERO = 0


# 余额变动类型(增加)
BALANCE_INC = 1
# 余额变动类型(减少)
BALANCE_DEC = 2

# 图片类型
IMG_STYLE = ['jpg', 'png', 'jpeg']

# 超时时间常量(秒)
EXPIRE_TIME = 10

# 通用状态
STATUS_UNKNOWN = 0  # 未知
STATUS_ENABLE = 1  # 正常
STATUS_DISABLE = 2  # 禁用

COMMON_STATUS_TABLE = Choices(
    (STATUS_UNKNOWN, "0 未知"),
    (STATUS_ENABLE, "1  正常"),
    (STATUS_DISABLE, "2 禁用")
)
